package com.skivingcloud.report.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.mybatisflex.annotation.ColumnMask;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.mybatisflex.core.mask.Masks;
import io.swagger.v3.oas.annotations.media.Schema;

/**
 * 报表数据源 实体类。
 *
 * @author skivingcloud
 * @since 2024-11-07
 */
@Schema(description = "报表数据源")
@Table("report_datasource")
public class ReportDatasource implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @Id
    @Schema(description = "主键id")
    private String id;

    /**
     * 租户
     */
    @Schema(description = "租户")
    private String tenantId;

    /**
     * 编码
     */
    @Schema(description = "编码")
    private String code;

    /**
     * 数据库名称
     */
    @Schema(description = "数据库名称")
    private String name;

    /**
     * 数据库类型 1mysql 2oracle 3 sqlserver 4api
     */
    @Schema(description = "数据库类型 1mysql 2oracle 3 sqlserver 4api")
    private String type;

    /**
     * 驱动
     */
    @Schema(description = "驱动")
    private String driverClass;

    /**
     * 数据库链接url
     */
    @Schema(description = "数据库链接url")
    private String jdbcUrl;

    /**
     * 登录名
     */
    @Schema(description = "登录名")
    private String userName;

    /**
     * 密码
     */
    @Schema(description = "密码")
    @ColumnMask(Masks.PASSWORD)
    private String password;

    /**
     * 属性前缀
     */
    @Schema(description = "属性前缀")
    private String apiColumnsPrefix;

    /**
     * api返回列
     */
    @Schema(description = "api返回列")
    private String apiColumns;

    /**
     * api返回类型 String Array ObjectArray Object
     */
    @Schema(description = "api返回类型 String Array ObjectArray Object")
    private String apiResultType;

    /**
     * 请求方式 post get
     */
    @Schema(description = "请求方式 post get")
    private String apiRequestType;

    /**
     * 接口请求头
     */
    @Schema(description = "接口请求头")
    private String apiRequestHeader;

    /**
     * 创建人
     */
    @Schema(description = "创建人")
    private String creator;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    /**
     * 更新人
     */
    @Schema(description = "更新人")
    private String updater;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    /**
     * 是否删除 1是 0否
     */
    @Schema(description = "是否删除 1是 0否")
    private String delFlag;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDriverClass() {
        return driverClass;
    }

    public void setDriverClass(String driverClass) {
        this.driverClass = driverClass;
    }

    public String getJdbcUrl() {
        return jdbcUrl;
    }

    public void setJdbcUrl(String jdbcUrl) {
        this.jdbcUrl = jdbcUrl;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getApiColumnsPrefix() {
        return apiColumnsPrefix;
    }

    public void setApiColumnsPrefix(String apiColumnsPrefix) {
        this.apiColumnsPrefix = apiColumnsPrefix;
    }

    public String getApiColumns() {
        return apiColumns;
    }

    public void setApiColumns(String apiColumns) {
        this.apiColumns = apiColumns;
    }

    public String getApiResultType() {
        return apiResultType;
    }

    public void setApiResultType(String apiResultType) {
        this.apiResultType = apiResultType;
    }

    public String getApiRequestType() {
        return apiRequestType;
    }

    public void setApiRequestType(String apiRequestType) {
        this.apiRequestType = apiRequestType;
    }

    public String getApiRequestHeader() {
        return apiRequestHeader;
    }

    public void setApiRequestHeader(String apiRequestHeader) {
        this.apiRequestHeader = apiRequestHeader;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getUpdater() {
        return updater;
    }

    public void setUpdater(String updater) {
        this.updater = updater;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

}
